package config;

public class Sql2zcConfig {
	//---------------------------------------------------------------交易执行sql------------------------------------------------------------------------------------------
		public static String insertZcOrder = "insert into zc_order(order_num,item_size,total,create_time,user_id,user_mp,user_name,user_areaId,user_area,user_address,remark) values (?,?,?,?,?,?,?,?,?,?,?)";
		public static String insertZcOrderLog = "insert into zc_orderLog(user_mp,log_time,log,order_num) values (?,?,?,?)";
		public static String insertZcUser = "insert into zc_user(wxid) values (?)";
		public static String insertZcUserAddr = "insert into zc_userAddr(user_id,area_id,user_name,user_mp,area,address,def) values (?,?,?,?,?,?,?)";
		public static String insertNorUserBill = "insert into log_noruserbill(log_norUserBill_userID,log_norUserBill_updateTime,log_norUserBill_money,log_norUserBill_balance,log_norUserBill_contentType,log_norUserBill_content,log_norUserBill_payment,log_norUserBill_payMobile,log_norUserBill_inSeq,log_norUserBill_type,log_norUserBill_status) values(?,?,?,?,?,?,?,?,?,?,?)";
		public static String insertLogIncome = "insert into log_income(log_income_typeId,log_income_orgId,log_income_orgName,log_income_agentId,log_income_userId,log_income_createTime,log_income_money,log_income_feedbackMoney,log_income_channel,log_income_inSeq,log_income_status) values(?,?,?,?,?,?,?,?,?,?,?)";
		
		public static String editZcUserAddr = "update zc_userAddr set user_name=?,user_mp=?,address=?,def=? where id=?";
		public static String editZcUserAddrDef = "update zc_userAddr set def=0 where def=1";
		public static String editZcUserAddrDefById = "update zc_userAddr set def=1 where id=?";
		public static String editNorUserBillStatus = "update log_noruserbill set log_norUserBill_outTradeNo=?,log_norUserBill_balance=?,log_norUserBill_status=1 where log_norUserBill_inSeq=?";
		public static String editZcorderPayStatus = "update zc_order set pay_status=?,pay_time=? where order_num=?";
		public static String editZcorderStatus = "update zc_order set status=1,end_time=? where order_num=?";
		public static String editZcorderItemStatus = "update zc_orderItem set status=2,end_time=? where id=?";
		public static String updateUserBalance = "update user set user_balance=? where user_weChatNumber=?";
		public static String updateLogIncomeStatus = "update log_income set log_income_outSeq=?,log_income_balance=?,log_income_status=1 where log_income_inSeq=?";
		
		public static String delZcZcUserAddr = "delete from zc_userAddr where id=?";
		
		public static String queryLogncomeStatus = "select li.log_income_status from log_income li where li.log_income_inSeq=?";
		public static String queryLogNorUserBillCount = "select count(ln.log_norUserBill_id) from log_noruserbill ln where ln.log_norUserBill_inSeq=?";
		public static String queryUserBalance = "select u.user_balance from user u where u.user_weChatNumber=? for update";
		public static String queryLogNorUserBill="select lub.log_norUserBill_inSeq,lub.log_norUserBill_money,lub.log_norUserBill_balance,lub.log_norUserBill_updateTime from log_noruserbill lub where lub.log_norUserBill_status=1 and  lub.log_norUserBill_userID=? order by lub.log_norUserBill_updateTime desc";
		public static String queryLogincome="select li.log_income_channel,li.log_income_createTime,li.log_income_balance,li.log_income_money from log_income li where li.log_income_status=1 and li.log_income_typeId=5 and li.log_income_orgId=? order by li.log_income_createTime desc";
		
		public static String queryAreas = "select a.id,a.province,a.city,a.county,a.area from zc_area a  where a.city=? limit ?,?";
		public static String queryAreasByAreaId = "select a.id,a.province,a.city,a.county,a.area from zc_area a  where a.id=? limit 1";
		public static String queryAreasCount = "select count(a.id) from zc_area a  where a.city=?";
		public static String queryZcOrder="select o.id,o.order_num,o.create_time,o.end_time,o.status,o.item_size,o.total,o.pay_status,o.user_mp,o.remark from zc_order o where o.user_id=? and o.status=?";
		public static String queryZcOrderByNum="select o.id,o.order_num,o.create_time,o.end_time,o.status,o.item_size,o.total,o.pay_status,o.user_mp,o.remark from zc_order o where o.order_num=? limit 1";
		public static String queryZcOrderCompleted="select o.id,o.order_num,o.create_time,o.end_time,o.status,o.item_size,o.total,o.pay_status,o.user_mp,o.remark from zc_order o where o.user_id=? and o.status in (1,2) limit ?,?";
		public static String queryZcOrderCompletedCount = "select count(o.id) from zc_order o  where o.user_id=? and o.status in (1,2)";
		public static String queryZcOrderItems="select e.gname,e.gprice,e.gcount,e.send_time from zc_orderItem e where  e.order_num=? ";
		public static String queryZcSendItems="select e.id,e.gname,e.gcount,o.pay_status,e.user_area,e.user_address,e.user_name,e.user_mp from zc_orderItem e left join zc_order o on e.order_num=o.order_num where e.status=1 and e.suser_id=? and e.send_time between ? and ? limit ?,?";
		public static String queryZcSendItemsCount="select count(e.id) from zc_orderItem e  where e.status=1 and e.suser_id=? and e.send_time=? ";
		public static String queryZcSendItemsByMp="select e.id,e.gname,e.gcount,o.pay_status,e.status,e.user_area,e.user_address,e.user_name,e.user_mp from zc_orderItem e left join zc_order o on e.order_num=o.order_num where e.status in(1,2) and e.user_mp like ? and e.suser_id=? and e.send_time=? ";
		public static String queryZcSendItemById="select e.id,o.pay_status,e.status,e.send_time,e.order_num from zc_orderItem e left join zc_order o on e.order_num=o.order_num where e.id=? ";
		public static String queryZcOrderLog="select l.log_time,l.log,l.user_mp from zc_orderLog l where l.order_num=?";
		public static String querySendItemsCountByNum="select count(e.id) from zc_orderItem e where e.status in (0,1) and e.order_num=?";
		//一到星期五每天去N条
		//public static String queryZcItemsBylandmarkId="select zi.id,zi.name,zi.price,zi.week from zc_item zi where zi.id in (select zic.iid from zc_item_category zic where zic.cid=?)  and 1>=(select count(zi1.id) from zc_item zi1 where zi.week=zi1.week) order by zi.week asc,zi.id desc";
		public static String queryZcItemsBylandmarkId ="select zi.id,zi.name,zi.price,zi.week from zc_item zi where zi.id in (select zic.iid from zc_item_category zic where zic.cid=?) group by zi.week ";
		public static String queryZcUser = "select u.id,u.wxid from zc_user u where u.wxid=? limit 1";
		public static String queryZcUserAddr = "select a.id, a.user_name,a.user_mp,a.area_id,a.area,a.address,a.def from zc_userAddr a where a.user_id=? and a.area_id=? and a.def=1 limit 1";
		public static String queryZcUserAddrById = "select a.id, a.user_name,a.user_mp,a.area_id,a.area,a.address,a.def from zc_userAddr a where a.id=? limit 1";
		public static String queryZcUserAddrList = "select a.id, a.user_name,a.user_mp,a.area_id,a.area,a.address,a.def from zc_userAddr a where a.user_id=? and a.area_id=? order by a.def desc ";
		public static String queryZcAdmin="select u.user_id,u.user_mobileNum,u.user_firstName,u.user_lastName,u.user_webName,u.user_webPwd  from user u where u.user_webName=?  and u.user_status=0";
		public static String queryZcUserOpenId="select u.wxid from zc_user u where u.id=?";
		public static String adminLogin="select u.user_id,u.user_mobileNum,u.user_firstName,u.user_lastName  from user u where u.user_webName=? and u.user_webPwd=? and u.user_status=0";
		
}
